package systemRouter

import (
	"context"
	"go_admin/internal/controller/system"
	"go_admin/internal/service"

	"github.com/gogf/gf/v2/net/ghttp"
)

var systemRouter = system.NewV1()

var R = new(Router)

type Router struct{}

func (router *Router) BindController(ctx context.Context, group *ghttp.RouterGroup) {
	group.Group("/system", func(group *ghttp.RouterGroup) {
		// 登录验证拦截
		service.Token().Middleware(group)
		// context拦截器
		group.Middleware(service.Middleware().Ctx, service.Middleware().Auth)
		// 后台操作日志记录
		group.Hook("/*", ghttp.HookAfterOutput, service.SysOperLog().OperationLog)

		group.Bind(systemRouter)
	})

}
